import React, {Component} from 'react';
import { Badge,Card,NoticeBar, Button,Scroller,Popup,Group, Field, Toast,NumberPicker, Context,SelectField, SwitchField  } from 'saltui';

// <InputSwitch value onChange>
export default class InputSwitch extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      value:this.props.value
    };
  }

  handleTextChange = (key,value) =>{
    this.state.value = value;
    this.setState({value:this.state.value});
    this.props.onChange(key,value);
  }

  render(){
    return   <SwitchField
      label={this.props.label}
      on={this.state.value}
      onChange={this.handleTextChange.bind(this, this.state.key)}
    />

  }

}
